package cn.achao.csr.api.model.entity;

import java.util.Date;
import java.io.Serializable;

import cn.achao.csr.api.model.dto.MessageExtraDTO;
import cn.achao.csr.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.*;

/**
 * (ChatMsg)实体类
 *
 * @author achao
 * @since 2025-02-06 16:27:33
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class ChatMsg extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 294641025107991248L;

    /**
     * 主键
     */
    @TableId(type = IdType.ASSIGN_ID)
    private Long id = super.getId();
    /**
     * 房间id
     */
    private Long roomId;
    /**
     * 消息发送者uid
     */
    private Long fromUid;
    /**
     * 消息内容
     */
    private String content;
    /**
     * 发送时间
     */
    private Date sendTime;
    /**
     * 消息类型
     */
    private Integer type;
    /**
     * 回复的消息内容
     */
    private Long replyMsgId;
    /**
     * 消息扩展字段
     */
    @TableField(value = "extra", typeHandler = JacksonTypeHandler.class)
    private MessageExtraDTO extra;
    /**
     * 消息状态
     */
    private String status;
    /**
     * 创建者
     */
    private String createBy;
    /**
     * 更新者
     */
    private String updateBy;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 更新时间
     */
    private Date updateTime;
    /**
     * 是否删除
     */
    private Boolean isDel;
    /**
     * 备注
     */
    private String remark;

    /**
     * INSERT INTO `csr`.`leaf_alloc` (`biz_tag`, `max_id`, `step`, `description`)
     * VALUES ('seq_chat_msg', 1, 500, 'chat_msg主键');
     * @return
     */
    @Override
    public String sequenceCode() {
        return "seq_chat_msg";
    }

    public ChatMsg(Boolean generateId) {
        super(generateId);
    }
}

